var GameData = require('../../module/GameData')();


cc.Class({
    extends: cc.Component,

    properties: {
        All_achieve_item: cc.SpriteAtlas,
        ach_sp: cc.Sprite,
        btn_got: cc.Node,
        dsc: cc.Label,
        score:cc.Label,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},
    init(data) {
        this.ach_sp.getComponent(cc.Sprite).spriteFrame = this.All_achieve_item.getSpriteFrame(data.ach_sp);
        if (data.is_get) {
            this.btn_got.active = true;
            this.node.getChildByName("bg").getComponent(cc.Sprite).spriteFrame=this.All_achieve_item.getSpriteFrame("bg_completed");
            this.node.getChildByName("bg").getComponent(cc.Button).interactable=false;
        } else {
            this.node.getChildByName("bg").getComponent(cc.Sprite).spriteFrame=this.All_achieve_item.getSpriteFrame("bg_normal");
            this.btn_got.active = false;
            this.node.getChildByName("bg").getComponent(cc.Button).interactable=true;
        }
        if( !data.isshow){
            this.node.getChildByName("progress_point").active=false;
        }
        this.dsc.string=data.dsc;
        this.score.string=data.score;
    },
    start() {

    },
    click_btn(){
        GameData.achieve_layer.tip.getComponent("Tips").init();
        console.log("ssssss")


    }
    // update (dt) {},
});
